package com.qf.controller;

import com.qf.entity.OrderVO;
import com.qf.entity.UserVO;
import com.qf.service.OrderService;
import com.qf.service.UserService;
import com.qf.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Demo2Controller {
    @Autowired
    private OrderService orderService;
    @Autowired
    private UserService userService;
    @GetMapping("/order/user/{oid}")
    public R findOrderWithUserByOid(@PathVariable int oid){
        OrderVO orderVO=orderService.findOrderWithUserByOid(oid);
        return R.success(orderVO);
    }
    @GetMapping("/user/order/{id}")
    public R findUserWithOrdersById(@PathVariable int id){
        UserVO userVO=userService.findUserWithOrdersById(id);
        return R.success(userVO);
    }
}
